package com.utc.teamcenter.common.app.dialog.bean;

import javax.swing.JButton;
import javax.swing.JComponent;

public class BeanJButton extends BeanComponent {

	private JButton field;
	
	private boolean isRequired = false;

	public BeanJButton(String key, String name, String title, boolean value, boolean required) {
		super(key, name);
		this.field = new JButton(title);
		this.field.setName(key);
		this.field.setSelected(value);
	}

	
	@Override
	public void clear() {
		this.field.setText("");
	}

	@Override
	public JComponent getComponent() {
		return this.field;
	}

	@Override
	public String getText() {
		return this.field.getText();
	}

	@Override
	public boolean isRequired() {
		return this.isRequired;
	}

	@Override
	public void setText(String text) {
		this.field.setText(text);
	}

	@Override
	public void setRequired(boolean required) {
		this.isRequired = required;
	}

	@Override
	public void requestFocus() {
		this.field.requestFocus();
	}

	@Override
	public void setEnabled(boolean bool) {
		this.field.setEnabled(bool);
	}

	@Override
	public void setVisible(boolean bool) {
		this.field.setVisible(bool);
	}
	
	public boolean getSelected() {
		return this.field.isSelected();
	}
	
	public void setSelected(boolean bool ) {
		this.field.setSelected(bool);
	}
}
